//
//  TCUXMLParser.h
//  TreeMenuTest
//
//  Created by Etienne on 12/07/07.
//  Copyright (c) 2007 Etienne Samson. All rights reserved.
//

#import <Cocoa/Cocoa.h>

typedef enum TCUXMLParserOption__ {
    TCUXMLParserValidateDocument = kCFXMLParserValidateDocument, // Unsupported
    TCUXMLParserSkipMetaData = kCFXMLParserSkipMetaData,
    TCUXMLParserReplacePhysicalEntities = kCFXMLParserReplacePhysicalEntities, // Unsupported
    TCUXMLParserSkipWhitespace = kCFXMLParserSkipWhitespace,
    TCUXMLParserResolveExternalEntities = kCFXMLParserResolveExternalEntities,
    TCUXMLParserAddImpliedAttributes = kCFXMLParserAddImpliedAttributes, // Unsupported
    TCUXMLParserAllOptions = kCFXMLParserAllOptions,
    TCUXMLParserNoOptions = kCFXMLParserNoOptions
} TCUXMLParserOption;

@interface TCUXMLParser : NSObject {

}
- (id)initWithContentsOfURL:(NSURL *)url;  // initializes the parser with the specified URL.
- (id)initWithContentsOfURL:(NSURL *)url options:(TCUXMLParserOption)options;  // initializes the parser with the specified URL.

- (id)initWithData:(NSData *)data; // create the parser from data
- (id)initWithData:(NSData *)data options:(TCUXMLParserOption)options; // create the parser from data

    // delegate management. The delegate is not retained.
- (id)delegate;
- (void)setDelegate:(id)delegate;

- (BOOL)parse;	// called to start the event-driven parse. Returns YES in the event of a successful parse, and NO in case of error.
- (void)abortParsing;	// called by the delegate to stop the parse. The delegate will get an error message sent to it.

- (NSError *)parserError;	// can be called after a parse is over to determine parser state.
@end

// Once a parse has begun, the delegate may be interested in certain parser state. These methods will only return meaningful information during parsing, or after an error has occurred.
@interface TCUXMLParser (TCUXMLParserLocatorAdditions)
- (NSString *)publicID;
- (NSString *)systemID;
- (int)lineNumber;
- (int)columnNumber;
@end
